package com.huiyan.hysys.controller;

import com.huiyan.hysys.config.SystemConfig;
import com.huiyan.hysys.service.intf.OssLogService;
import com.huiyan.hysys.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;


@RestController
@RequestMapping("/api/oss/")
@CrossOrigin
public class OssLogController {
    @Autowired
    private OssLogService service;
    @PostMapping("upload.do")
    public R upload(MultipartFile file, HttpServletRequest request) throws IOException {
        return service.upload(file,request.getHeader(SystemConfig.USER_TOKEN));
    }
    @GetMapping("all.do")
    public R all(){
        return service.all();
    }

}
